/*
 * Created on 2006-02-05
 */
package dk.aiszone.lang.utils;

import junit.framework.TestCase;

/**
 * Test cases for the <code>ArrayUtils</code> class.
 * 
 * @author <a href="mailto:ais@mail.dk">Ais</a>
 */
public class ArrayUtilsTest extends TestCase {

    /**
     * Simple <code>toString</code> test.
     */
    public void testArrayToString() {
        Boolean[] array = new Boolean[] { Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE };

        String toString = ArrayUtils.arrayToString(array);

        assertEquals("toString", "false, true, true, false", toString);
    }

    /**
     * Simple <code>toString</code> test - with alternative seperator
     */
    public void testArrayToString_AlternativeSeperator() {
        Boolean[] array = new Boolean[] { Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE };

        String toString = ArrayUtils.arrayToString(array, "| ");

        assertEquals("toString", "false| true| true| false", toString);
    }

    /**
     * Simple <code>toString</code> test - with empty and <code>null</code> array.
     */
    public void testArrayToStringEmpty() {
        Boolean[] array = new Boolean[] {};

        String toString = ArrayUtils.arrayToString(array, "| ");

        assertEquals("toString", "", toString);

        array = null;

        toString = ArrayUtils.arrayToString(array, "| ");

        assertEquals("toString", "", toString);

    }
}